import { View } from "../../../../mvc/core/View";
import { GuildDefenseInfoPanel } from "./GuildDefenseInfoPanel";
import { UiHintIconView } from "../../uiIconBtn/UiHintIconView";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ECopyType } from "../../../../../Message/Public/ECopyType";
import { EGuildPosition } from "../../../../../Message/Game/EGuildPosition";
import { SceneRange } from "../../../scene/map/SceneRange";
import { BaseHintIcon } from "../../common/hintIcon/BaseHintIcon";
import { ImagesConst } from "../../../resource/ImagesConst";
type int = number;
//class GuildCopyDefenseView
    
    export  class GuildCopyDefenseView extends View
    {
        constructor()
        {
            super();
            return;
        }

        public get defenseInfoPanel(): GuildDefenseInfoPanel
        {
            if (!this._defenseInfoPanel) 
            {
                this._defenseInfoPanel = new GuildDefenseInfoPanel();
            }
            return this._defenseInfoPanel;
        }

        public showOpenHintIcon(): void
        {
            UiHintIconView.instance.addHintIcon(this.openHintIcon);
            return;
        }

        public hideOpenHintIcon(): void
        {
            if (this._openHintIcon && this._openHintIcon.parent) 
            {
                UiHintIconView.instance.removeHintIcon(this.openHintIcon);
            }
            return;
        }

        /* internal  */onHintIconClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GuildOpenCopyWindow, ECopyType._ECopyGuildDefense));
            return;
        }

        public showDefenseInfoPanel(): void
        {
            this.defenseInfoPanel.show();
            this.defenseInfoPanel.updateInfos();
            this.defenseInfoPanel.updateBuildInfos();
            this.stageResize();
            return;
        }

        public hideDefenseInfoPanel(): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.hide();
            }
            return;
        }

        public updateDefenseCopyInfo(): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.updateInfos();
            }
            return;
        }

        public updateDefenseBuildInfo(): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.updateBuildInfos();
            }
            return;
        }

        public updateDefenseBossRing(arg1: int): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.updateBossRing(arg1);
            }
            return;
        }

        public updateDefenseContribute(arg1: int): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.updateCon(arg1);
            }
            return;
        }

        public updateDefenseExp(arg1: int): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.updateExp(arg1);
            }
            return;
        }

        public updateGuildPosition(arg1: int): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                if (arg1 == EGuildPosition._EGuildLeader || arg1 == EGuildPosition._EGuildDeputyLeader) 
                {
                    this._defenseInfoPanel.enableLevelButtons();
                }
                else 
                {
                    this._defenseInfoPanel.unableLevelButtons();
                }
            }
            return;
        }

        public stageResize(): void
        {
            if (this._defenseInfoPanel && !this._defenseInfoPanel.isHide) 
            {
                this._defenseInfoPanel.x = SceneRange.display.width - 320;
                this._defenseInfoPanel.y = 178;
            }
            return;
        }

        public get openHintIcon(): BaseHintIcon
        {
            if (!this._openHintIcon) 
            {
                this._openHintIcon = new BaseHintIcon(ImagesConst.copyHintIcon);
                this._openHintIcon.addEventListener(flash.events.MouseEvent.CLICK, this.onHintIconClick);
            }
            return this._openHintIcon;
        }

        /* internal */ /* var */_openHintIcon: BaseHintIcon;

        /* internal */ /* var */_defenseInfoPanel: GuildDefenseInfoPanel;
    }
